package com.example.context;

import com.example.annotation.AsyncMessageHandler;
import lombok.Data;
import org.aspectj.lang.ProceedingJoinPoint;

/**
 * 消息处理上下文
 */
@Data
public class MessageHandlerContext {
    private ProceedingJoinPoint joinPoint;
    private AsyncMessageHandler annotation;
    private Object[] args;
    private int retryCount = 0;
    
    public MessageHandlerContext(ProceedingJoinPoint joinPoint, AsyncMessageHandler annotation) {
        this.joinPoint = joinPoint;
        this.annotation = annotation;
        this.args = joinPoint.getArgs();
    }
    
    public boolean canRetry() {
        return retryCount < annotation.retryTimes();
    }
    
    public void incrementRetryCount() {
        retryCount++;
    }
} 